#include<bits/stdc++.h>
using namespace std ;

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, totalAmount, X;
    cin >> n >> totalAmount >> X;

    vector<int> returnRateLst(n);
    vector<int> riskLst(n);
    vector<int> maxAmountLst(n);

    for (int i = 0; i < n; i++) {
        cin >> returnRateLst[i];
    }

    for (int i = 0; i < n; i++) {
        cin >> riskLst[i];
    }

    for (int i = 0; i < n; i++) {
        cin >> maxAmountLst[i];
    }

    int maxReturn = 0;
    // 记录投资组合
    // pairs[i][0]表示第i个投资组合的下标
    // pairs[i][1]表示第i个投资组合的投资金额
    vector<vector<int>> pairs(2, vector<int>(2, 0));

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            // 如果风险值超过X，则跳过
            if (riskLst[i] + riskLst[j] > X) {
                continue;
            }

            // 计算当前组合的投资金额 
            int iAmount, jAmount;

            // 如果两个投资组合的投资金额之和小于等于总金额，则直接取最大投资金额
            if (maxAmountLst[i] + maxAmountLst[j] <= totalAmount) {
                iAmount = maxAmountLst[i];
                jAmount = maxAmountLst[j];
            } else {
                // 否则，根据投资回报率来分配投资金额
                // 如果i的投资回报率大于等于j的投资回报率，则i的投资金额为min(maxAmountLst[i], totalAmount)
                // 否则，j的投资金额为min(maxAmountLst[j], totalAmount)
                // i的投资金额为totalAmount - j的投资金额
                // j的投资金额为totalAmount - i的投资金额
                if (returnRateLst[i] >= returnRateLst[j]) {
                    iAmount = min(maxAmountLst[i], totalAmount);
                    jAmount = totalAmount - iAmount;
                } else {
                    jAmount = min(maxAmountLst[j], totalAmount);
                    iAmount = totalAmount - jAmount;
                }
            }
            // 计算当前组合的投资回报
            int curReturn = iAmount * returnRateLst[i] + jAmount * returnRateLst[j];

            // 更新最大投资回报以及投资组合
            if (curReturn > maxReturn) {
                maxReturn = curReturn;
                pairs[0][0] = i;
                pairs[0][1] = iAmount;
                pairs[1][0] = j;
                pairs[1][1] = jAmount;
            }
        }
    }

    // 输出结果
    vector<int> ans(n, 0);
    ans[pairs[0][0]] = pairs[0][1];
    ans[pairs[1][0]] = pairs[1][1];

    for (int i = 0; i < n; i++) {
        cout << ans[i] << " ";
    }

    return 0;
}
